﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>代理商列表-微街秀管理后台</title>
    <link href="../css/admin.css" rel="stylesheet" type="text/css" />
    <link href="../css/css.css" rel="stylesheet" type="text/css" />
<style>
body{ background-color:White; font-size:14px;}
table{border-collapse: collapse;border: none;width:100%; text-align:center;}
td{border: solid #ccc 1px;color:Black; height:26px;}
td a{ text-decoration:none;}
.td1,.td2,.td3,.td6{width:100px; font-weight:bold; text-align:center;}
.td4,.td5{width:250px; font-weight:bold; text-align:center;}
.td4{width:80px;}
</style>
    <script src="../js/jquery-1.9.1.min.js" type="text/javascript"></script>
    <script src="../js/base.js" type="text/javascript"></script>
    <script src="../js/ajax-data.js" type="text/javascript"></script>
    <script src="../js/Pager.js" type="text/javascript"></script>
    <script src="../js/dialog.js" type="text/javascript"></script>
</head>
<body>
<div style="width:880px; margin-left:auto; margin-right:auto;">
<div> 会员编号:<input type="text" id="userid" name="userid" style="width:80px;" />
    标题:<input type="text" id="sitename" name="sitename" style="width:120px;"/>
    状态：
    <select id="state">
    <option value="-1">不限</option>
    <option value="0">未审核</option>
    <option value="1">已审核</option>
    <option value="2">已拒绝</option>
    </select>
    <input type="button" id="btn" value="搜 索" onclick="submits()" /></div>
    <br />
  <table>
  <tr>
    <td class='td1' style="width:40px;">ID</td>
    <td class='td5'>标题</td>
    <td class='td2' style="width:60px;">浏览数</td>
    <td class='td3'>发布时间</td>    
    <td class='td4' style="width:60px;">微街秀ID</td>
    <td class='td4' style="width:60px;">状态</td>
    <td class='td3' style="width:60px;">操作</td>
  </tr>
  <tbody id="list">
  </tbody>
    </table>
 <div class="pager_style">
    <ul class="page_num"></ul>
    <ul class="page_info">
        <li>总数:<span id="count">0</span></li>
        <li>每页:<span id="pageSize">0</span></li>
        <li>页数:<span id="pageToal">0</span></li>
    </ul>
</div>
<input type="hidden" id="pagecount" value="0" />
</div>
 <script>
     $(function () {
         var sitename = getUrlArgStr("sitename");
         $("#sitename").html(decodeURIComponent(sitename));
         GetList(1);     
     })

     function GetList(page) {
         var param = "page_index=" + page + "&state=" + $("#state").val();
         var userid = $("#userid").val();
         var sitename = $("#sitename").val();
         
         if (userid != "")
             param += "&author_id=" + userid;

         if (sitename != "")
             param += "&title=" + decodeURIComponent(sitename);

         $("#list").html("");
         var html = "";
         AjaxStart("../ajax/Article.ashx?GetList", param, function (data) {
             if (data.code != 0) {
                 $("#list").html(html + "<tr><td colspan='8'>" + data.msg + "</td></tr>");
             }
             else {
                 $("#list").html("");
                 var list = data.item.table;
                 for (var i = 0; i < list.length; i++) {
                     html += "<tr>";
                     html += "<td>" + list[i].id + "</td>";
                     html += "<td style='text-align:left;'><img src='" + list[i].logo + "' style='height:50px;'><a href='../../client/detail.aspx?article_id=" + list[i].id + "'  target=\"_blank\">" + list[i].title + list[i].state + "</a></td>";
                     html += "<td>" + list[i].click + "</td>";
                     html += "<td>" + GetDate(list[i].date) + "</td>";
                     html += "<td>" + list[i].user_id + "</td>";
                     var s = "未审核" ;
                     if (list[i].state == 1)
                         s = "已审核";
                     else if (list[i].state == 2)
                         s = "<span style='color:red'>已拒绝</span>";
                     html += "<td>" + s + "</td>";
                     html += "<td><a  id='ok_" + list[i].id + "' href='javascript:void(0)' onclick=edit('" + list[i].id + "',1)>通过</a> | <a id='no_" + list[i].id + "' href='javascript:void(0)' onclick=edit('" + list[i].id + "',2)>拒绝</a>    <a href='javascript:void(0)' onclick=\"del('" + list[i].id + "')\" style='display:none'>删除</a></td>";
                     html += "</tr>";
                 }
                 $("#list").html(html);
                 var pager = new Pager();
                 $(".page_info").css("display", "block")
                 pager.initPage(page, data.item.itemCount, 20, 5, GetList);
             }
         });     
     }

     function submits() {
         GetList(1);
     }

     function del(id) {

     }

     function edit(id, state) {
         AjaxStart("../ajax/Article.ashx?Check", "state=" + state + "&id=" + id, function (data) {
             if (data.code == 0) {
                 if (state == 2) {
                     $("#ok_" + id).html("通过");
                     $("#no_" + id).html("<span style='color:#ccc'>拒绝</span>");
                     Alert("成功拒绝");
                 }
                 else {
                     Alert("成功通过");
                     $("#ok_" + id).html("<span style='color:#ccc'>通过</span>");
                     $("#no_" + id).html("拒绝");
                 }
             }
             else
                 Alert(data.msg);
         });
     }

 </script>
</body>
</html>
